function getNowFormatDate() {
    var date = new Date();
    var seperator1 = "-";
    var seperator2 = ":";
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }
    var currentdate = year + seperator1 + month + seperator1 + strDate;
    return currentdate;
}

function getAllGoods(){
	$.ajax({
		type:'post',
		url: "goodsQuery.action",
		data:{searchKey : $("#searchKey").val()},
		dataType: "json",
		success: function(data){
			var list = eval(data).result;
			var htmlstr = ""
			if(list.length>0){
				for(var i=0;i<list.length;i++){
					htmlstr += "<div class=\"col_1_of_single1 span_1_of_single1\">";
					htmlstr += "<a href=\"goodDetail.action?gid="+list[i].id+"\"><img src=\""+list[i].img+"\" class=\"img-responsive\" alt=\"\" />";
					htmlstr += "<h3>"+list[i].goodsname+"</h3>";
					htmlstr += "<p>"+list[i].remark+"</p>";
					htmlstr += "<h4>"+list[i].price+"</h4>";
					htmlstr += "</a>";
					htmlstr += "</div>";
				}
			}
			$("#span_3").html(htmlstr);
		}
	})
}

function search() {
	getAllGoods();
}

$(document).ready(function(){
	$("#search").css({"display":"inline"});
	getAllGoods();
})
